package com.hoshiicloud.mallshop.feign.hystrix;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.query.OmnipotentParam;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.goods.entity.goods.Gallery;
import com.hoshiicloud.goods.entity.goods.GoodsCategory;
import com.hoshiicloud.goods.entity.sku.*;
import com.hoshiicloud.goods.entity.spu.BaseGoodsGallery;
import com.hoshiicloud.goods.entity.spu.BaseSpu;
import com.hoshiicloud.goods.entity.spu.ExtSpu;
import com.hoshiicloud.goods.param.ListSkuSpuParam;
import com.hoshiicloud.goods.param.sku.*;
import com.hoshiicloud.goods.param.spu.BaseSpuAddParam;
import com.hoshiicloud.goods.param.spu.BaseSpuUpdateParam;
import com.hoshiicloud.goods.param.spu.ExtSpuAddParam;
import com.hoshiicloud.goods.param.spu.ExtSpuUpdateParam;
import com.hoshiicloud.goods.vo.BranchStoreGoodsVo;
import com.hoshiicloud.goods.vo.GoodsPropertiesVo;
import com.hoshiicloud.goods.vo.ListSpuSkuVo;
import com.hoshiicloud.goods.vo.sku.BaseSkuVo;
import com.hoshiicloud.mallshop.feign.ShopGoodsSpuSkuFeignService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
public class ShopGoodsSpuSkuFeignServiceFallback implements FallbackFactory<ShopGoodsSpuSkuFeignService> {
    @Override
    @HystrixCommand
    public ShopGoodsSpuSkuFeignService create(Throwable throwable) {
        log.error("shop聚合调用goods失败"+throwable.toString());
        return new ShopGoodsSpuSkuFeignService(){
            @Override
            public Response<BaseSpu> saveBaseSpu(BaseSpuAddParam param) {
                return Response.failed("保存BaseSpu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateBaseSpu(BaseSpuUpdateParam param) {
                return Response.failed("根据Id更新BaseSpu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateBaseSpuBatch(OmnipotentParam<BaseSpu> param) {
                return Response.failed("批量更新baseSpu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<ProductManage> getProductManageOneByStoreIdAndSkuId(Map<String, Object> map) {
                return Response.failed("根据店铺ID和扩展skuid 获取sku分配表（productManage）信息失败"+ throwable.getMessage());
            }

            @Override
            public Response updateProductMangerById(ProductManageUpdateParam param) {
                return Response.failed("更新sku分配表（productManage）信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ProductManage>> listProductManageByParam(ProductManageQueryParam param) {
                return Response.failed("根据条件获取sku分配表（productManage）信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveProductManageBatch(List<ProductManage> allProductManage) {
                return Response.failed("批量新增sku分配表（productManage）信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Page<BranchStoreGoodsVo>> listBranchStoreGoods(BranchStoreProductPageParam param) {
                return Response.failed("查询分店下的商品信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveProductManage(ProductManageAddParam param) {
                return Response.failed("新增分店下的商品信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> deleteProductManger(Long id) {
                return Response.failed("删除分店下的商品信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateProductMange(OmnipotentParam<ProductManage> param) {
                return Response.failed("批量更新商品管理信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Map<String, String>> getStoreSkuNum(List<Long> storeIds) {
                return Response.failed("获取每个店对应的sku数量失败"+ throwable.getMessage());
            }

            @Override
            public Response<Map<String, List<String>>> queryExtskuAndBaseSkuIds(List<Long> storeIds) {
                return Response.data(new HashMap<>());
            }

            @Override
            public Response<List<ExtSku>> listExtSkuByParam(ExtSkuQueryParam param) {
                return Response.failed("根据任意条件查询扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveExtSkuBatch(List<ExtSku> allExtSku) {
                return Response.failed("批量新增扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<ExtSku> getExtSkuOneByStoreIdAndSkuId(Map<String, Object> map) {
                return Response.failed("根据店铺ID和baseSkuId获取扩展sku信息失败"+ throwable.getMessage());

            }

            @Override
            public Response<ExtSku> saveExtSku(ExtSkuAddParam param) {
                return Response.failed("新增扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response extSkuUpdate(ExtSkuUpdateParam param) {
                return Response.failed("更新扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> deleteExtSku(Long id) {
                return Response.failed("删除扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateExtSkuBatch(OmnipotentParam<ExtSku> param) {
                return Response.failed("批量更新ExtSpu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ExtSku>> listExtSku(List<OmnipotentWrapper> params) {
                return Response.failed("批量查询 ExtSku失败"+ throwable.getMessage());
            }

            @Override
            public Response<Page<ListSpuSkuVo>> getBranchStoreCanAddSkuPage(ListSkuSpuParam param) {
                return Response.failed("获取分店可添加的拓展sku分页列表失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<String>> dropdownBox(Long companyId, String propertyName) {
                return Response.failed("查询包装单位和销售单位失败"+throwable.getMessage());
            }

            @Override
            public Response<List<GoodsPropertiesVo>> getProperByCateId(Long categoryId, Long companyId) {
                return Response.failed("查询类目属性信息失败"+throwable.getMessage());
            }

            @Override
            public Response<List<Map<String, Object>>> getGoodsBrandsByCateId(Long cateId) {
                return Response.failed("查询类目下的品牌信息失败:"+throwable.getMessage());
            }

            @Override
            public Response<String> getCategoryContext(String categoryContextQueryStr) {
                return Response.failed("根据三级类目id查询类目名称失败"+ throwable.getMessage());
            }

            @Override
            public Response<GoodsCategory> getGoodsCategoryById(Long id) {
                return Response.failed("通过Id查询类目名称失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveGalleryBath(List<Gallery> galleries) {
                return Response.failed("批量保存相册信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateGalleryBatch(OmnipotentParam<Gallery> param) {
                return Response.failed("批量更新相册信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveBaseGoodsGalleryBatch(List<BaseGoodsGallery> baseGoodsGalleries) {
                return Response.failed("批量保存BaseSpu与相册关联信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateBaseGoodsGalleryBatch(OmnipotentParam<BaseGoodsGallery> param) {
                return Response.failed("批量更新baseGoodsGallery失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> removeBaseGoodsGalleryBatch(List<OmnipotentWrapper> param) {
                return Response.failed("批量删除baseGoodsGallery： 物理删除失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveBaseSkuGallery(BaseSkuGalleryAddParam param) {
                return Response.failed("保存BaseSku的图片信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateBaseSkuGalleryBatch(OmnipotentParam<BaseSkuGallery> param) {
                return Response.failed("批量更新基础SKU商品图片资源失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveVendorGoodsSku(VendorGoodsSkuAddParam param) {
                return Response.failed("保存供应商商品SKU信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateVendorGoodsSkuBatch(OmnipotentParam<VendorGoodsSku> params) {
                return Response.failed("批量更新供应商sku表失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> vendorGoodsSkuUpdate(VendorGoodsSkuUpdateParam param) {
                return Response.failed("通过Id 更新VendorGoodsSku失败"+ throwable.getMessage());
            }

            @Override
            public Response<ExtSpu> getExtSpuById(Long id) {
                return Response.failed("根据Id获取扩展spu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ExtSpu>> listExtSpuByStoreId(Long storeId) {
                return Response.failed("获取某店扩展spu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> saveExtSpuBatch(List<ExtSpu> allExtSpu) {
                return Response.failed("批量新增扩展spu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<ExtSpu> getExtSpuOneByStoreIdAndSpuId(Map<String, Object> map) {
                return Response.failed("根据店铺Id和baseSpuId获取拓展spu信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<ExtSpu> saveExtSpu(ExtSpuAddParam param) {
                return Response.failed("新增拓展spu信息失败"+ throwable.getMessage());

            }

            @Override
            public Response<List<ExtSpu>> queryOmnipotentExtSpu(List<OmnipotentWrapper> wrappers) {
                return Response.failed("根据条件查询扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> extSpuUpdate(ExtSpuUpdateParam param) {
                return Response.failed("更新扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> deleteExtSpu(Long id) {
                return Response.failed("删除扩展sku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<Long> getExtSpuMaxWeight(Long storeId) {
                return Response.failed("获得该店铺下商品权重的最大值失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateExtSpuBatch(OmnipotentParam<ExtSpu> param) {
                return Response.failed("批量更新ExtSpu失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<ExtSpu>> listExtSpuByIds(List<Long> ids) {
                return Response.failed("通过 extSkuId 的集合查询 ExtSku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<BaseSkuVo>> listBaseSkuByParam(SkuBaseListParam param) {
                return Response.failed("根据条件查询baseSku信息失败"+ throwable.getMessage());
            }

            @Override
            public Response<BaseSku> saveBaseSku(BaseSkuAddParam param) {
                return Response.failed("保存BaseSku信息, 并返回保存的 BaseSku对象失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateBaseSkuBatch(OmnipotentParam<BaseSku> param) {
                return Response.failed("批量更新BaseSku失败"+ throwable.getMessage());
            }

            @Override
            public Response<List<BaseSku>> listBaseSku(List<OmnipotentWrapper> params) {
                return Response.failed("批量查询baseSku失败"+ throwable.getMessage());
            }

            @Override
            public Response<Boolean> baseSkuUpdate(BaseSkuUpdateParam param) {
                return Response.failed("通过Id 更新BaseSku信息失败"+ throwable.getMessage());
            }

        };
    }
}
